package com.linkhub.oms.admin.modules.track.controller;

import com.linkhub.oms.admin.modules.track.service.WebhookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author Jaycle
 * @version 1.0.0
 * @Description WebhookController.java
 * @createTime 2024/10/10 23:16
 */
@Slf4j
@RestController
@Api(tags = {"17track webhook接口"})
@RequestMapping("/track")
public class WebhookController {

    @Resource
    private WebhookService webhookService;

    @PostMapping("/notify")
    @ApiOperation(value = "17track物流信息回调接口")
    public void notify( @RequestBody String body, @RequestHeader(value = "sign", required = false) String sign ) {
        log.info("回调信息为：{}，sign: {}", body, sign);
        webhookService.saveNotify(body, sign);
    }

}
